!
! Logon script for ReadCIX all 
!
! Please feel free to modify this script to suit your needs.
! If you need to change to suit your Modem then the relevant parts are shown
! Search for ! to find the places
!
!
! Change here to tailor to your Modem
!  
    SETUP (
     Baud=19200:
     Stop=1 :
     Parity=none :
     Handshake=rtscts
     Fail=None :
     Timeout=20 :
     Echo=off :
     Data=8 )
    ON send fail goto bad
    SET c1=4
MENU "Do You wish to Connect to CIX" (
     "YES" GOTO yes
     "NO" GOTO no
     )
yes:
 MENU "Choose Phone Type" (
     "Direct Line" GOTO dir
     "Switchboard" GOTO swt
     )
swt:
    Query "Switchboard" (
    "Outside line No:",s6)
dir:
rAlive:
!
!Change here to set up for your Modem
!
		SEND "ATZ"
    WAIT 20 ( ON reply "OK<$d><$a>" GOTO alive )
    ON c1 GOTO rAlive
    GOTO merror
alive:
    SET C1=3
    GOTO reDial   
wait100:
    INFO "Waiting to redial"
    WAIT 60
reDial:
    SEND "ATDT<s6><CixNumber>"
    WAIT 120 (
	ON reply "CONNECT" GOTO letsgo
	ON reply "NO DIALTONE" GOTO tele
	ON reply "NO CARRIER" GOTO nocar
	ON reply "ERROR" GOTO black
	ON reply "BUSY" GOTO again )
    GOTO merror
again:
    ON c1 GOTO wait100
    ALERT "Line busy" : EXIT
letsGo:
    INFO "CONNECTED..."
    SENDWAIT 160 "<$d>";,"login:" GOTO noLog
    SENDWAIT 160 "qix<$d>";,"new user)" GOTO noUser
    SENDWAIT 130 "<CixUserName>","Password:" GOTO noPass
    SEND "<CixPassword>"
tryAgain:
    WAIT 40 (
	ON REPLY "Main:" GOTO gotMain
	ON REPLY "More" GOTO gotMore )
    ALERT "SOMETHING STRANGE"
gotMain:
ALERT "You are Now Online to CIX" 
no:
EXIT
gotMore:
    WAIT 1
    SEND "n"
    GOTO tryAgain
black:
    ALERT "Number dialled too many times" : EXIT
nocar:
    ALERT "No connection made" : EXIT
tele:
    ALERT "Check connected to telephone" : EXIT
merror:
    ALERT "Check modem connected" : EXIT
bad:
    ALERT "Check RS232 lead connected" : EXIT
noLog:
    ALERT "No Login received" : EXIT
noUser:
    ALERT "No user name" : EXIT
noPass:
    ALERT "No password" : EXIT
noMain:
    ALERT "No main"
    EXIT
